
//
//  MJCustomHeader.m
//  zhilian
//
//  Created by 李丹 on 2019/9/4.
//  Copyright © 2019 LZT. All rights reserved.
//

#import "MJCustomHeader.h"
@interface MJCustomHeader()
@property (strong, nonatomic) UILabel *label;
@end

@implementation MJCustomHeader
#pragma mark - 重写方法
#pragma mark 在这里做一些初始化配置（比如添加子控件）
- (void)prepare
{
    [super prepare];
    
    // 设置控件的高度
    self.mj_h = 64;
    
    // 添加label
    UILabel *label = [[UILabel alloc] init];
    label.textColor = RGB(51, 51, 51);
    label.font = TGAutoFont(15);
    label.textAlignment = NSTextAlignmentCenter;
    [self addSubview:label];
    self.label = label;
}

#pragma mark 在这里设置子控件的位置和尺寸
- (void)placeSubviews
{
    [super placeSubviews];
    
    [self.label sizeToFit];
    
//    CGFloat x = (self.mj_w - (_arrowImageView.width + RatioWidth(10) + self.label.width))/2;
//    self.arrowImageView.left = x ;
//    self.label.left = self.arrowImageView.right + RatioWidth(10);
//    self.label.centerY = self.centerY;
//    self.arrowImageView.centerY = self.centerY;
    
}

#pragma mark 监听scrollView的contentOffset改变
- (void)scrollViewContentOffsetDidChange:(NSDictionary *)change
{
    [super scrollViewContentOffsetDidChange:change];
}

#pragma mark 监听scrollView的contentSize改变
- (void)scrollViewContentSizeDidChange:(NSDictionary *)change
{
    [super scrollViewContentSizeDidChange:change];
}

#pragma mark 监听scrollView的拖拽状态改变
- (void)scrollViewPanStateDidChange:(NSDictionary *)change
{
    [super scrollViewPanStateDidChange:change];
}

#pragma mark 监听控件的刷新状态
- (void)setState:(MJRefreshState)state
{
    MJRefreshCheckState;
    switch (state) {
        case MJRefreshStateIdle:
            self.label.text = @"上拉查看图文详情";
            break;
        case MJRefreshStateRefreshing:
            self.label.text = @"上拉查看图文详情";
            break;
        case MJRefreshStateNoMoreData:
            self.label.text = @"没有数据了";
            break;
        default:
            break;
    }
}
@end
